<template>
  <div class="module1">
    <div class="module1-head">新闻动态</div>
    <div class="module1-content">
      <el-carousel class="carousel" :interval="5000" arrow="never">
        <el-carousel-item v-for="(item, index) in list" :key="index">
          <div class="xxnm">
            <div class="xxnm-left">
              <img :src="item.newsPic" alt="" class="img-view" />
            </div>
            <div class="xxnm-right">
              <div class="xxnm-right-head">{{ item.newsTitle }}</div>
              <div class="xxnm-right-txt">
                {{ item.newsContext }}
              </div>
            </div>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>
<script setup>
import imgUrl1 from '@/assets/img/1.png'
import { ref, watch, toRaw } from 'vue'
const props = defineProps({
  data: {
    type: Array,
    default: () => []
  }
})
const list = ref([])
watch(
  () => props.data,
  (newValue) => {
    const _newValue = toRaw(newValue)
    console.log('新闻', _newValue)
    list.value = _newValue
  },
  {
    immediate: true
  }
)
</script>
<style scoped lang="scss">
.module1 {
  width: 100%;
  height: 100%;
  padding-top: 20px;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  .module1-head {
    width: 100%;
    max-width: 405px;
    height: 33px;
    background: url('@/assets/img/card-head.png') no-repeat center;
    background-size: 100% 100%;
    font-family: FZZYJW;
    font-weight: normal;
    font-size: 20px;
    color: #c3ff55;
    line-height: 24px;
    padding-left: 42px;
  }
  .module1-content {
    flex: 1;
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 14px;
    color: #ffffff;
    line-height: 24px;
    .carousel {
      height: 100%;
      :deep(.el-carousel__container) {
        height: 100%;
        overflow: hidden;
        overflow-y: auto;
      }
    }
    .xxnm {
      display: flex;
      justify-content: flex-start;
      align-items: stretch;
      gap: 10px;
      .xxnm-left {
        .img-view {
          width: 140px;
          height: 140px;
          // display: block;
        }
      }
      .xxnm-right {
        .xxnm-right-head {
          font-family: Source Han Sans CN;
          font-weight: 400;
          font-size: 16px;
          color: #ffffff;
          line-height: 24px;
        }
        .xxnm-right-txt {
          font-family: Source Han Sans CN;
          font-weight: 400;
          font-size: 12px;
          color: #ffffff;
          line-height: 24px;
        }
      }
    }
  }
}
</style>
